const HtmlWebpackPlugin = require('html-webpack-plugin');
const { merge } = require("webpack-merge");
const path = require('path');
const commonConfig = require("./webpack.common.js");
const devConfig = require("./webpack.dev.js");
const prodConfig = require("./webpack.prod.js");

console.log(process.env.NODE_ENV);
console.log(process.env.NAME);

const isProd = process.env.NODE_ENV === "production";

module.exports = mode => {
    console.log(mode, 'mode', isProd);
    const config = merge(commonConfig, isProd ? prodConfig : devConfig);
    console.log(JSON.stringify(config));
    return config;
}